#include "common.h"

struct rte_mempool * g_mpool = NULL;
uint32_t g_src_ip = 0;
uint32_t g_dst_ip = 0;
uint8_t g_src_mac[RTE_ETHER_ADDR_LEN] = {0};
uint8_t g_dst_mac[RTE_ETHER_ADDR_LEN] = {0};
uint16_t g_src_port = 0;
uint16_t g_dst_port = 0;
uint32_t g_local_ip = MAKE_IPV4_ADDRESS(192, 168, 3, 66);
unsigned char fd_table[MAX_FD_COUNT] = {0};   // bitmap 个数为 MAX_FD_COUNT * 8
struct inout_ring * rInstance = NULL;
struct local_host * g_hosts = NULL;
struct tcp_table * tcpInstance = NULL;
const struct rte_eth_conf port_conf_default = {.rxmode = {.max_lro_pkt_size = RTE_ETHER_MAX_LEN}};  // 最大的rx包
uint8_t g_default_arp_mac[RTE_ETHER_ADDR_LEN] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
struct arp_table_s * arp_table = NULL;
struct rte_kni *global_kni = NULL;

uint8_t * get_dst_mac_address(uint32_t dip){
    struct arp_entry_s * iter;
    struct arp_table_s * table = arp_table_instance();
    for(iter = table->entries; iter != NULL; iter = iter->next){
        if(dip == iter->ip){
            return iter->hwaddr;
        }
    }
    return NULL;
}

